package com.zut.yyzx.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zut.yyzx.dto.NurseRecordDTO;
import com.zut.yyzx.dto.OutwardDTO;
import com.zut.yyzx.pojo.Nurserecord;
import com.zut.yyzx.service.NurserecordService;
import com.zut.yyzx.service.OutwardService;
import com.zut.yyzx.utils.ResultVo;
import com.zut.yyzx.vo.NurseRecordsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;




@RestController
@RequestMapping("/nurserecord")
@CrossOrigin
//"护理记录管理"
public class NurserecordController {
    @Autowired
    private NurserecordService nurserecordService;
    @Autowired
    private OutwardService outwardService;
    //"添加护理记录"
    @PostMapping("/addNurseRecord")
    public ResultVo addNurseRecord(Nurserecord nurserecord) throws  Exception{
        return nurserecordService.addNurseRecord(nurserecord);
    }

    @GetMapping("/listNurseRecordsVo")
    //"客户护理记录信息动态查询（分页）"
    public  ResultVo<Page<NurseRecordsVo>> listNurseRecordsVo(NurseRecordDTO nurseRecordDTO) throws Exception{
        return nurserecordService.queryNurseRecordsVo(nurseRecordDTO);
    }
    @GetMapping("/removeCustomerRecord")
    //"移除护理记录"
    public  ResultVo removeCustomerRecord(Integer id) throws Exception{
        Nurserecord nurseRecord=new Nurserecord();
        nurseRecord.setIsDeleted(1);
        nurseRecord.setId(id);
        nurserecordService.updateById(nurseRecord);
        return ResultVo.ok("移除成功");
    }
    //"查询外出记录"
    @PostMapping("/queryOutwardVo")
    public ResultVo queryOutwardVo(OutwardDTO outwardDTO) throws  Exception{
        return outwardService.queryOutwardVo(outwardDTO);
    }
}
